<html>
<head><meta charset="utf-8"><title>Improving the experience  on Sublime Text · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html">Improving the experience  on Sublime Text</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="196903576"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196903576" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196903576">(May 08 2020 at 14:42)</a>:</h4>
<p>Hi, I've been using rust-analyzer for few weeks now on Sublime Text with the LSP plugin. I noticed some cases where the plugin wouldn't work and even some cases where it would crash. I decided to try and debug the problems. First of all, my problem manifests when editing a single file, stand-alone (no external deps except for stdlib) .rs file with no associated Cargo.toml. What is the expected behaviour of Rust-Analyzer in this case?</p>



<a name="196906226"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196906226" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196906226">(May 08 2020 at 15:02)</a>:</h4>
<p>Files outside of a project/workspace are not supported, so it's expected to not start.</p>



<a name="196906691"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196906691" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196906691">(May 08 2020 at 15:05)</a>:</h4>
<p>I see, thanks!</p>



<a name="196907103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196907103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196907103">(May 08 2020 at 15:08)</a>:</h4>
<p>Btw. are project/workspace-less files not supported at the LSP level, or is it a current limitation of Rust-analyzer?</p>



<a name="196913275"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196913275" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196913275">(May 08 2020 at 15:53)</a>:</h4>
<p>So, after trying all kinds of things, I found out that I can trigger a crash in cases where there exists a project structure, with Cargo.toml and all, but I open "just" the source file itself with  <code>subl src/main.rs</code>. Now that I can reliably reproduce it, I'll try and debug it.</p>



<a name="196913888"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196913888" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196913888">(May 08 2020 at 15:57)</a>:</h4>
<p>I don't know if it's a bug in Sublime's LSP or in Rust-analyzer, but I'll try and fix it nevertheless.</p>



<a name="196919430"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196919430" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196919430">(May 08 2020 at 16:43)</a>:</h4>
<p>Allright, I managed to get my hands to the LSP &lt;-&gt; Rust-Analyzer log so I can try to make sense of it. However, I thought that I could, for interactive debugging, also start rust-analyzer from command line and copy-paste messages to it, but I'm having another problem here</p>



<a name="196919791"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196919791" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196919791">(May 08 2020 at 16:46)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124002">Pyry Kontio</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Improving.20the.20experience.20.20on.20Sublime.20Text/near/196907103" title="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Improving.20the.20experience.20.20on.20Sublime.20Text/near/196907103">said</a>:</p>
<blockquote>
<p>Btw. are project/workspace-less files not supported at the LSP level, or is it a current limitation of Rust-analyzer?</p>
</blockquote>
<p>limitation of rust-analyzer</p>



<a name="196919797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196919797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196919797">(May 08 2020 at 16:46)</a>:</h4>
<p>Trying to paste the original initialize message, but it manages to paste only 1024 characters before freezing (ctrl-C helps to kill it). Sounds like a buffering thing?</p>



<a name="196920035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196920035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196920035">(May 08 2020 at 16:47)</a>:</h4>
<p>that may be a terminal issue</p>



<a name="196920073"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196920073" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196920073">(May 08 2020 at 16:47)</a>:</h4>
<p>try putting everything you want to send in a file and then do <code>cat file | rust-analyzer</code></p>



<a name="196938288"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196938288" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196938288">(May 08 2020 at 19:14)</a>:</h4>
<p>Hmm, I'm getting a ProtocolError, and I realized that LSP's "payload log" doesn't log the communication verbatim but indeed, just the "payloads" so I can't easily copy-paste the messages for reference</p>



<a name="196938369"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196938369" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196938369">(May 08 2020 at 19:15)</a>:</h4>
<p>So, I need either to re-generate the surrounding headers + JSON-RPC-messages by hand or do something more clever.</p>



<a name="196938555"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196938555" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196938555">(May 08 2020 at 19:17)</a>:</h4>
<p>I tried to search Rust-analyzer repo for tests that would have sample files for the protocol but I couldn't find any. Is the closest one you're doing to integration testing, these ones? <a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/rust-analyzer/tests/heavy_tests/main.rs" title="https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/rust-analyzer/tests/heavy_tests/main.rs">https://github.com/rust-analyzer/rust-analyzer/blob/master/crates/rust-analyzer/tests/heavy_tests/main.rs</a></p>



<a name="196938585"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196938585" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196938585">(May 08 2020 at 19:17)</a>:</h4>
<p>No tests that send raw data verbatim to the rust-analyzer binary?</p>



<a name="196938586"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196938586" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196938586">(May 08 2020 at 19:17)</a>:</h4>
<p><span class="user-mention silent" data-user-id="124002">Pyry Kontio</span> <a href="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Improving.20the.20experience.20.20on.20Sublime.20Text/near/196913275" title="#narrow/stream/185405-t-compiler.2Fwg-rls-2.2E0/topic/Improving.20the.20experience.20.20on.20Sublime.20Text/near/196913275">said</a>:</p>
<blockquote>
<p>So, after trying all kinds of things, I found out that I can trigger a crash in cases where there exists a project structure, with Cargo.toml and all, but I open "just" the source file itself with  <code>subl src/main.rs</code>. Now that I can reliably reproduce it, I'll try and debug it.</p>
</blockquote>
<p>I don't think that works</p>



<a name="196938620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196938620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196938620">(May 08 2020 at 19:17)</a>:</h4>
<p>It didn't work for me in Code when I tried it earlier</p>



<a name="196938717"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196938717" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196938717">(May 08 2020 at 19:18)</a>:</h4>
<p>Works in the sense that you don't think Rust-analyzer works or my way of debugging doesn't work?</p>



<a name="196938818"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196938818" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196938818">(May 08 2020 at 19:19)</a>:</h4>
<p>I thought that surely this isn't a desirable outcome so I'd figure should debug it <a href="/user_uploads/4715/rH5PlmXiwJOW9lz1papFuc-8/スクリーンショット-2020-05-09-4.19.04.png" title="スクリーンショット-2020-05-09-4.19.04.png">スクリーンショット-2020-05-09-4.19.04.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/rH5PlmXiwJOW9lz1papFuc-8/スクリーンショット-2020-05-09-4.19.04.png" title="スクリーンショット-2020-05-09-4.19.04.png"><img src="/user_uploads/4715/rH5PlmXiwJOW9lz1papFuc-8/スクリーンショット-2020-05-09-4.19.04.png"></a></div>



<a name="196938945"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196938945" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196938945">(May 08 2020 at 19:20)</a>:</h4>
<p><a href="/user_uploads/4715/Qvi60yPVsCtWoWOv-AhZIhO4/image.png" title="image.png">image.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/Qvi60yPVsCtWoWOv-AhZIhO4/image.png" title="image.png"><img src="/user_uploads/4715/Qvi60yPVsCtWoWOv-AhZIhO4/image.png"></a></div>



<a name="196938971"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196938971" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196938971">(May 08 2020 at 19:20)</a>:</h4>
<p>Ah, in that sense! Yes, I'd appreciate an error message like that.</p>



<a name="196938985"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196938985" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196938985">(May 08 2020 at 19:20)</a>:</h4>
<p>Instead of a crash.</p>



<a name="196939004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196939004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196939004">(May 08 2020 at 19:21)</a>:</h4>
<p>So, let's fix that!</p>



<a name="196939031"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196939031" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196939031">(May 08 2020 at 19:21)</a>:</h4>
<p>Got it :-)</p>



<a name="196939148"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196939148" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196939148">(May 08 2020 at 19:22)</a>:</h4>
<p>Maybe Sublime doesn't show the error? I mean, it <em>does</em> crash.</p>



<a name="196939944"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196939944" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196939944">(May 08 2020 at 19:29)</a>:</h4>
<p>Looking at the log, it might be upon LSP: Rust-analyzer does send this: "window/showMessage: {'message': 'rust-analyzer failed to discover workspace, no Cargo.toml found, dirs searched: /Applications/Sublime Text.app/Contents/MacOS', 'type': 1}"</p>



<a name="196940090"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196940090" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196940090">(May 08 2020 at 19:30)</a>:</h4>
<p>Then it sends this: "$/progress: {'token': 'rustAnalyzer/startup', 'value': {'message': 'rust-analyzer loaded, 1 packages', 'kind': 'end'}}", but the LSP plugin doesn't like that: "LSP: unknown $/progress token: rustAnalyzer/startup"</p>



<a name="196940385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196940385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196940385">(May 08 2020 at 19:33)</a>:</h4>
<p>After that, once I change something, the plugin sends a textDocument/didChange message, and RA panicks with "Error: LspError { code: -32900, message: "Rust file outside current workspace is not supported yet." }"</p>



<a name="196940621"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196940621" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196940621">(May 08 2020 at 19:35)</a>:</h4>
<p>Haven't delved into the protocol yet, so I haven't got much of a clue what is to be expected and what is wrong. I'm gonna sleep now but continuing tomorrow! If somebody has any words of wisdom, I'm all ears!</p>



<a name="196976629"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196976629" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196976629">(May 09 2020 at 06:33)</a>:</h4>
<p>Progress reporting is a newer LSP feature: <a href="https://microsoft.github.io/language-server-protocol/specification#progress" title="https://microsoft.github.io/language-server-protocol/specification#progress">https://microsoft.github.io/language-server-protocol/specification#progress</a></p>



<a name="196978577"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/196978577" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#196978577">(May 09 2020 at 07:34)</a>:</h4>
<p>It's likely that Sublime doesn't support it yet. That's fine, since there's support in the protocol for exposing client capabilities, but rust-analyzer doesn't respect all of them yet. I filed <a href="https://github.com/rust-analyzer/rust-analyzer/issues/4384" title="https://github.com/rust-analyzer/rust-analyzer/issues/4384">https://github.com/rust-analyzer/rust-analyzer/issues/4384</a> for this specific case.</p>



<a name="197002823"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197002823" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197002823">(May 09 2020 at 17:32)</a>:</h4>
<p>So, I looked into the communication between the LSP plugin and RA.  Actually, the LSP plugin does list the <code>workDoneProgress</code> capability, so it supports capabilities. The error message "LSP: unknown $/progress token: rustAnalyzer/startup" seems to about that RA hasn't earlier registered a token named "rustAnalyzer/startup" to track progress of.</p>



<a name="197002904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197002904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197002904">(May 09 2020 at 17:34)</a>:</h4>
<p>But that is not the reason why it crashes, the LSP plugin reports about a crash just because RA panics:<br>
Error: LspError { code: -32900, message: "Rust file outside current workspace is not supported yet." }<br>
thread '&lt;unnamed&gt;' panicked at 'called <code>Result::unwrap()</code> on an <code>Err</code> value: "SendError(..)"', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/lsp-server-0.3.1/src/stdio.rs:29:13</p>



<a name="197002965"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197002965" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197002965">(May 09 2020 at 17:36)</a>:</h4>
<p>It sends a "window/showMessage" notification about the unsupported case before, but maybe it should send an error response instead of a succesful init message when the init message passes "workspaceFolders":null to it</p>



<a name="197003077"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197003077" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197003077">(May 09 2020 at 17:39)</a>:</h4>
<p>Ah, when opening it with proper workspace, it sends the window/workDoneProgress/create message.</p>



<a name="197003119"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197003119" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197003119">(May 09 2020 at 17:40)</a>:</h4>
<p>I wonder how big a project would it be to implement a support for workspace/projectless, stand-alone files</p>



<a name="197003127"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197003127" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197003127">(May 09 2020 at 17:40)</a>:</h4>
<p>This usecase interests me because I do it often these days</p>



<a name="197007035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197007035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197007035">(May 09 2020 at 19:09)</a>:</h4>
<p>Correction: supports capabilities → supports the proggress capability</p>



<a name="197033651"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197033651" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197033651">(May 10 2020 at 05:02)</a>:</h4>
<p>So, I read through the developer documentation. The core system seems very well thought of! It seems that basically all the work that needs to be done is concentrated in <a href="https://github.com/rust-analyzer/rust-analyzer/tree/master/crates/rust-analyzer" title="https://github.com/rust-analyzer/rust-analyzer/tree/master/crates/rust-analyzer">https://github.com/rust-analyzer/rust-analyzer/tree/master/crates/rust-analyzer</a></p>



<a name="197033660"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197033660" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197033660">(May 10 2020 at 05:03)</a>:</h4>
<p>I'm going to look through that codebase now</p>



<a name="197039188"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197039188" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Laurențiu <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197039188">(May 10 2020 at 07:26)</a>:</h4>
<p>See also <a href="https://github.com/rust-analyzer/rust-analyzer/issues/3715" title="https://github.com/rust-analyzer/rust-analyzer/issues/3715">https://github.com/rust-analyzer/rust-analyzer/issues/3715</a></p>



<a name="197043535"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197043535" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197043535">(May 10 2020 at 09:10)</a>:</h4>
<p>So... there is a comment <code>FIXME: support dynamic workspace loading.</code> in <a href="http://main_loop.rs" title="http://main_loop.rs">main_loop.rs</a>. So of the LSP connection is established and no WS roots are given at beginning, there is no support currently for adding them later? I guess that's a major prerequisite for opening single files, or even files that belong to a cargo project but the project directory being unknown to the editor.</p>



<a name="197043643"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197043643" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197043643">(May 10 2020 at 09:14)</a>:</h4>
<p>The first point in time RA could infer the workspace, if not provided by the editor at start, is on textDocument/didOpen request</p>



<a name="197044916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197044916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197044916">(May 10 2020 at 09:37)</a>:</h4>
<p>Hmm, I have to be careful not to mix up LSP and RA concepts too much. Please tell me if my understanding is correct here: LSP used to have a concept rootPath / rootUri, and a later addition workspaceFolders to support multi-folder workspaces. However, the textDocument/didOpen requests are absolute URLs and may be not strictly contained to workspaces? Is LSP expected to "add" a workspace for opened documents or are there workspaceless documents?</p>



<a name="197045129"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197045129" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197045129">(May 10 2020 at 09:41)</a>:</h4>
<p>Then, RA has its VFS, and source roots, as described here: <a href="https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/guide.md#source-roots-aka-filesystems-are-horrible" title="https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/guide.md#source-roots-aka-filesystems-are-horrible">https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/dev/guide.md#source-roots-aka-filesystems-are-horrible</a>. Is this part still up to date, there were a bit of warning that this guide might be outdated. I guess that we need to support dynamically adding source roots, right? Is that currently supported?</p>



<a name="197045198"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197045198" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197045198">(May 10 2020 at 09:43)</a>:</h4>
<p>I'll try and read the source how textDocument/didOpen is currently handled!</p>



<a name="197047045"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197047045" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197047045">(May 10 2020 at 10:28)</a>:</h4>
<p>yeah, I think these kinds of things are mostly blocked on dynamic workspace configuration, which in turn is blocked on improving the <a href="https://github.com/rust-analyzer/rust-analyzer/issues/3715" title="https://github.com/rust-analyzer/rust-analyzer/issues/3715">VFS</a></p>



<a name="197048662"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Improving%20the%20experience%20%20on%20Sublime%20Text/near/197048662" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Kon / GolDDranks <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Improving.20the.20experience.20.20on.20Sublime.20Text.html#197048662">(May 10 2020 at 11:07)</a>:</h4>
<p>All right. Btw. I think that the name of this thread is not very accurate if it comes to improving dynamic workspace configuration. Seems that if that gets better, my problems with Sublime automatically get better too. I'm opening a new thread.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>